﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="房产销冠, 房地产,卡考网络" />
    <meta name="description" content="上海卡考网络有限公司" />
    <title>房产销冠</title>
    <link rel="stylesheet" href="css/list.css" type="text/css" />
    <link rel="stylesheet" href="css/global.css" type="text/css" />
    <link href="bootstrap/iCheck-master/skins/minimal/Orange.css" rel="stylesheet" type="text/css" />
    <!--<script src="js/jquery-1.8.3.min.js"></script>-->
    <!--<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />-->
    <script src="http://dn-blqw.qbox.me/jq+bs+art.js" type="text/javascript"></script>
    <!--<script src="js/jquery.easydropdown.min.js"></script>-->
    <!--<script src="bootstrap/iCheck-master/icheck.js"></script>-->
    <!--<script src="bootstrap/js/bootstrap.min.js"></script>-->
    <!--<script src="js/checkbox.js"></script>-->
    <script src="js/common.js"></script>
    <script src="js/PageIndex.js"></script>
    <script src="http://dn-blqw.qbox.me/kk.js"></script>

</head>
<body style="background: #f1f1f1;">
    <div class="main01">
        <div class="content clearfix">
            <div class="headline02">
                <div class="line_left">仓库商品<span>(<b id="RecordCount">0</b>)</span></div>
                <div class="line_right">
                    <ul class="nav_line_right">
                        <li class="con"><a href="#">首页</a></li>
                        <li>/</li>
                        <li class="con"><a href="#">商品管理</a></li>
                        <li>/</li>
                        <li class="con"><a href="#" style="color: #60b12a;">仓库商品</a></li>
                    </ul>
                </div>
            </div>
            <div class="bton">
                <div class="bton_left">
                    <select id="F_CityKid" class="selall sel100 fl" style="margin-right:11px;">
                        <option value="-1">请选择</option>
                    </select>
                    <select id="F_CateogryKid" class="selall sel100 fl" style="margin-right:11px;">
                        <option>商品类型</option>
                    </select>
                    <select name="status" id="status" class="selall sel100 fl" style="margin-right:11px;">
                        <option value="">状态</option>
                        <option value="0">下架</option>
                        <option value="1">上架</option>
                        <option value="2">失效</option>
                    </select>
                    <div class="fl mr10 fs14">商品标题:</div>
                    <input type="text" id="keyWord" class="selall sel100 fl" style="margin-right:11px;" />
                    <input type="button" value="搜索" class="sbtn" onclick="f_Seach()" />
                </div>
                <div class="bton_right">
                    <div class="bton_left_nav">
                        <a href="add_obj.html" class="btn_add last" target="rightMain">添加</a>
                    </div>
                    <div class="bton_left_nav pageIn2">
                    </div>
                </div>
            </div>
        </div>
        <div style="min-height: 500px;">
            <div style="min-width: 800px; overflow: auto;">
                <table class="table02" style="width: 100%; max-height: 400px; table-layout: fixed; border-bottom: 1px #e6e6e6 solid;">
                    <thead>
                        <tr class="info_title">
                            <th style="width: 60px;">序号</th>
                            <th class="mid_line">商品</th>
                            <th style="width: 130px;" class="mid_line">扣除积分</th>
                            <th style="width: 130px;" class="mid_line">剩余库存</th>
                            <th style="width: 100px;" class="mid_line">状态</th>
                            <th style="width: 160px" class="mid_line">过期时间</th>
                            <!--<th style="width: 130px" class="mid_line">操作</th>-->
                        </tr>
                    </thead>
                    <tbody>
                        <tr class="info_cont" style="display: none">
                            <td>{F_Index}</td>
                            <td>
                                <div class="con_btn">{F_PicUrl}</div>
                                <div class="con_btn"><span>{F_ShowName}</span></div>
                            </td>
                            <td>{F_PointNum}</td>
                            <td>{F_InventoryNum}</td>
                            <td>{F_Status}</td>
                            <td>{F_SoldoutTime}</td>
                            <!--<td>
                                <ul class="edit_nav">
                                    <li><a href="javascript:;" onclick="f_GetStatus({F_ProductKid},{IsStatus})">{IsButton}</a></li>
                                    <li><a disabled>预览</a></li>
                                    <li>{newStatus}</li>
                                    <li>{newStatusDel}</li>
                                </ul>
                            </td>-->
                        </tr>
                    </tbody>
                </table>
            </div>
            <!--放置分页 begin -->
            <table style="width: 100%; height: auto">
                <tr>
                    <td colspan="15">
                        <div class="pageIn"></div>
                    </td>
                </tr>
            </table>
            <!--放置分页 end -->
        </div>
    </div>
    <script type="text/javascript" src="js/list.js"></script>
    <script type="text/javascript">
       var PageIndex = 1;

        function f_GetProductCategoryList() {
            $kk.api.get("/ProductsCategory/GetList",function(data){
                $.each(data, function (i, obj) {
                    $("#F_CateogryKid").append("<option value='" + obj.Kid + "'>" + obj.F_CategoryName + "</option>");
                });
            });
        }
        $(function () {
            f_GetData();
            f_GetProductCategoryList();
            f_GetCityList();
        });
        function f_GetCityList() {
            var data = kk.api.get("/System/GetCityList", function (data) {
                $("#F_CityKid").empty();
                $.each(data, function (i, obj) {
                    $("#F_CityKid").append("<option value='" + obj.F_CityKid + "'>" + obj.F_CityName + "</option>");
                });
            });

        }
        function f_Seach()
        {
            f_GetData(1);
        }
        //获取商品详细
        function f_GetData(pageIndex) {
            var pageSize = 8;
            var idx = 0;
            var newUrlParStr = "";
            var categoryKid = $("#F_CateogryKid option:selected").val();
            if (isNaN(categoryKid) || categoryKid == "") {
                categoryKid = 0;
            }


            var cityKid = $("#F_CityKid option:selected").val();
            if (isNaN(cityKid) || cityKid == "") {
                cityKid = 0;
            }

            var status = $("#status option:selected").val();
            var keywords = $("#keyWord").val();
            newUrlParStr = "?categoryKid=" + categoryKid + "&status=" + status + "&keywords=" + keywords + "&pageSize=" + pageSize + "&pageIndex=" + (pageIndex ? pageIndex : 1)+"&cityKid="+cityKid;
            $kk.api.get("/ProductShow/GetList"+ newUrlParStr,function(res){
                kk.fillTable(".table02", res.Items, function (data, name) {
                    switch (name) {
                        case "F_Index":
                            idx++;
                            var otherCount = pageSize * (pageIndex - 1);
                            if (isNaN(otherCount)) {
                                otherCount = 0;
                            }
                            return idx + otherCount;
                        case "IsStatus":
                            switch (data["F_Status"]) {
                                case 0:
                                    return 1;
                                case 1:
                                    return 0;
                                case 2:
                                    return 2;
                            }
                            break;
                        case "F_Status":
                            switch (data[name]) {
                                case 0:
                                    return "下架";
                                case 1:
                                    return "上架";
                                case 2:
                                    return "失效"
                            }
                            break;
                        case "IsButton":
                            switch (data[name]) {
                                case 0:
                                    return "上架";
                                case 1:
                                    return "下架";
                                case 2:
                                    return "重置"
                            }
                            break;
                        case "newStatus":
                            switch (data["F_Status"]) {
                                case 0:
                                    return "<a href='add_obj.html?kid="+data["F_ProductKid"]+"'>编辑</a>";
                                case 1:
                                    return "<a href='goods_edit.html?kid="+data["F_ProductKid"]+"'>编辑</a>";
                            }
                            break;
                        case "newStatusDel":
                            switch (data["F_Status"]) {
                                case 0:
                                    return "<a onclick='f_delete("+data["F_ProductKid"]+")'>删除</a>";
                                case 1:
                                    return "<a disabled>删除</a>";
                            }
                            break;
                        case "F_PicUrl":
                            picSelect(data.Thumbs, data.F_PicUrl, 80);
                            return "<img src=\"" + pic + "\" alt=\"\" width=\"80\" height=\"46\"/>";
                    }
                });
                $("#RecordCount").html(res.Count);
                makePageBar(f_GetData,res.Count, pageIndex, pageSize);
                PageIndex=pageIndex;
            });

        }
        //删除
        function f_delete(kid) {
            kk.api.get("/ProductShow/Delete", { kids: kid });
            f_GetData(PageIndex);
        }
        function f_GetStatus(productKid,status) {
            kk.api.get("/ProductShow/Status",{ productKid: productKid ,status:status},function(data){
                f_GetData(PageIndex);
            });
        }
    </script>
</body>
</html>
